import Vue from 'vue'
import App from './App.vue'
import router from './router'

import hljs from 'highlight.js'

import './assets/css/index.scss'
import './assets/css/highlight/gruvbox-dark.css'

import { ListenError } from "./utils/listen-error";
const listenError = new ListenError();
//   暴露全局方法给 vue 或者react 用于框架内部捕获
window.errorVueHandler = listenError.errorVueHandler;
window.sendError = listenError.sendError


Vue.directive('highlight',function (el) {
  let blocks = el.querySelectorAll('pre code');
  blocks.forEach((block)=>{
    hljs.highlightBlock(block)
  })
})

import filters from './filters'

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.errorHandler = listenError.errorVueHandler;


Vue.config.productionTip = false
// Vue.use(ElementUI);
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
